package org.zhenggn.designpattern.chain;

import com.google.gson.Gson;

/**
 * Created by zhenggn on 2017/5/3.
 */
public class DeptManager extends Handler {
    public String handleFeeRequest(String user, double fee) {

        System.out.println("====================================== DeptManager start ======================================");
        System.out.println("sssssssss" + MyThreadLocal.get().getStr());

        User user32323 =  MyThreadLocal.get().getUser();

        System.out.println("----------------" + new Gson().toJson(MyThreadLocal.get().getUser()));

        user32323.setTelphone(1861);



        System.out.println("----------------" + new Gson().toJson(MyThreadLocal.get().getUser()));
        String str = "";
        if (fee < 1000) {
            if ("小李".equals(user)) {
                str = "部门经理同意" + user + "聚餐费用" + fee + "元的请求";
            } else {
                str = "部门经理不同意" + user + "聚餐费用" + fee + "元的请求";
            }
        } else {
            if (this.getSuccessor() != null) {
                return this.getSuccessor().handleFeeRequest(user, fee);
            }
        }
        System.out.println("====================================== DeptManager end ======================================");
        return str;
    }
}
